package com.bdqn.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bdqn.mapper.RightMapper;
import com.bdqn.pojo.Right;
import com.bdqn.service.RightService;
import jakarta.annotation.Resource;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;


@Service
public class RightServiceImpl extends ServiceImpl<RightMapper, Right>
        implements RightService {
    @Resource
   private RightMapper rightMapper;
    @Override
    @Cacheable(value = "right", key = "'all'", unless = "#result==null")
    public List<Right> findAll() {
        return super.list();
    }

    @Override
    @Cacheable(value = "right", key = "'roleId:'+#roleId", condition = "#roleId != null", unless = "#result==null")
    public Set<Right> findRightByRoleId(Long roleId) {
        return rightMapper.findRightByRoleId(roleId);
    }
}




